package com.chao.order.client;

import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author : Rookie
 * @description :
 * @date : 2022/9/18
 */
@FeignClient("seata-storge")
public interface StorgeFeignClient {

    /**
     * 扣除库存
     * @param productId 产品id
     * @param count 订单数量
     * @return
     */
    @GetMapping("/storge/deduct")
    Boolean deductStorge(@RequestParam("productId") String productId,@RequestParam("count") Integer count);

    @Slf4j
    class StorgeFeignFallBack implements StorgeFeignClient {

        @Override
        public Boolean deductStorge(String productId, Integer count) {
            log.info("服务器繁忙！");
            return false;
        }
    }
}
